//
//  PesoKit.m
//  Peso Guide
//
//  Created by macbook on 2025/6/5.
//

#import "PesoKit.h"

@implementation PesoKit

+ (UILabel *)createLabelWithFrame:(CGRect)frame backGroundColor:(UIColor *)backGroundColor text:(NSString *)text textColor:(UIColor *)textColor font:(UIFont *)font {
    UILabel *label = [[UILabel alloc] initWithFrame:frame];
    label.backgroundColor = backGroundColor;
    label.textColor = textColor;
    label.text = text;
    label.font = font;
    
    return label;
}

+ (UIButton *)createButtonWithFrame:(CGRect)frame backGroundColor:(UIColor *)backGroundColor title:(NSString *)title titleColor:(UIColor *)titleColor font:(UIFont *)font {
    UIButton *button = [[UIButton alloc] initWithFrame:frame];
    [button setBackgroundColor:backGroundColor];
    [button setTitle:title forState:0];
    [button.titleLabel setFont:font];
    [button setTitleColor:titleColor forState:0];
    
    return button;
}

+ (UIView *)createViewWithFrame:(CGRect)frame backGroundColor:(UIColor *)backGroundColor {
    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = backGroundColor;
    
    return view;
}

+ (UITextField *)createTextFieldWithFrame:(CGRect)frame backGroundColor:(UIColor *)backGroundColor text:(NSString *)text textColor:(UIColor *)textColor font:(UIFont *)font placeholder:(NSString *)placeholder {
    UITextField *textField = [[UITextField alloc] initWithFrame:frame];
    textField.backgroundColor = backGroundColor;
    textField.text = text;
    textField.textColor = textColor;
    textField.font = font;
    textField.placeholder = placeholder;
    
    return textField;
}

+ (UIScrollView *)createScrollViewWithFrame:(CGRect)frame backGroundColor:(UIColor *)backGroundColor {
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:frame];
    scrollView.backgroundColor = backGroundColor;
    
    return scrollView;
}

+ (UIImageView *)createImageViewWithFrame:(CGRect)frame imageNamed:(NSString *)imageNamed {
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
    if (imageNamed.length > 0) {
        imageView.image = [UIImage imageNamed:imageNamed];
    }else {
        imageView.backgroundColor = [UIColor clearColor];
    }
    
    return imageView;
}

+ (BaseTableView *)createTableViewWithFrame:(CGRect)frame backGroundColor:(UIColor *)backGroundColor {
    BaseTableView *tableView = [[BaseTableView alloc] initWithFrame:frame];
    tableView.backgroundColor = backGroundColor;
    
    return tableView;
}

+ (BaseTableView *)createTableViewWithFrame:(CGRect)frame backGroundColor:(UIColor *)backGroundColor style:(UITableViewStyle )style {
    BaseTableView *tableView = [[BaseTableView alloc] initWithFrame:frame style:style];
    tableView.backgroundColor = backGroundColor;
    
    return tableView;
}


@end
